home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / Ant Movie Catalog 3.5.0.2 / amc_install.exe / {app} / Scripts / Yusuketeam (FR).ifs < prev   
Text File  |  2005-05-23  |  13KB  |  370 lines

  1. (***************************************************
  2.  
  3. Ant Movie Catalog importation script
  4. www.antp.be/software/moviecatalog/
  5.  
  6. [Infos]
  7. Authors=ScorEpioN
  8. Title=Yusuketeam.com
  9. Description=RΘfΘrencement d'animes, Skin Winamp, AMV, Paroles...
  10. Site=http://www.yusuketeam.com
  11. Language=FR
  12. Version=04 du 23/05/2005
  13. Requires=3.5
  14. Comments=Ce script nΘcessite le fichier ScorEpioNCommonScript.pas|.==.| :   ' ( ( ( ( /\ |  "==()))))):     ⌐ ScorEpioN ⌐|       ( ( ( ( \_/
  15. License=Informations rΘcupΘrΘes sur le site www.yusuketeam.com,|avec l'autorisation de leurs webmasters.|
  16. GetInfo=1
  17.  
  18. [Options]
  19. Mise α jour=1|1|0=Oui|1=Non
  20. Type de Lancement=0|0|0=Demande le titre avant de lancer le script|1=Ne demande pas le titre avant de lancer le script|2=Cherche le meilleur rΘsultat sans confirmation|3=Lancement automatique sur l'adresse web
  21. Casse Choisie=3|3|0=Titre et Nom en minuscule|1=Titre et Nom en majuscule|2=PremiΦre lettre en majuscule|3=PremiΦre lettre de chaque mot en majuscule|4=Formatage identique au site d'origine
  22. Choix Titre=0|0|0=Titre dans Titre Traduit|1=Titre dans Titre Original
  23. Recherche sur le titre=0|0|0=Traduit|1=Original
  24. Fichier de log=1|1|0=Oui|1=Non
  25.  
  26. ***************************************************)
  27.  
  28. program Yusuketeam_FR;
  29. uses
  30.   ScorEpioNCommonScript;
  31.  
  32. const
  33.      VersionScript = '04 du 23/05/2005';
  34.      NomScript = 'YUSUKETEAM';
  35.      urlDomain = 'yusuketeam.com';
  36.      urlBase = 'http://www.yusuketeam.com/sfv/';
  37.      urlSearch = urlBase+'index.php';
  38.      urlSearchParams = 'serie_search=';
  39.      //urlReferer = 'http://www.yusuketeam.com/sfv/index.php';
  40.  
  41. var
  42.   MovieName, Address : string;
  43.   i,j, premiereExecution : Integer;
  44.   listeResultat : TStringList;
  45.  
  46. //------------------------------------------------------------------------------
  47. // RECUPERE LES RESULTATS YUSUKETEAM.COM
  48. //------------------------------------------------------------------------------
  49.  
  50. procedure recherche(title : String);
  51. var
  52.   Line, titre, adresse : String;
  53.   StartPos : Integer;
  54.   oK : Boolean;
  55. begin
  56.   //Line := PostPage2(urlSearch,urlSearchParams+UrlEncode(title),'application/x-www-form-urlencoded',urlReferer,False,False);
  57.   Line := PostPage(urlSearch,urlSearchParams+UrlEncode(title));
  58.   if pos('Aucun rΘsultat trouvΘ', Line) > 0 then
  59.   begin
  60.     SetField(fieldChecked, '');
  61.     exit;
  62.   end else
  63.   begin
  64.     oK := True;
  65.     listeResultat := TStringList.Create;
  66.     StartPos := pos('rΘsultats trouvΘs pour', Line);
  67.     delete(Line, 1, StartPos+length('rΘsultats trouvΘs pour')-1);
  68.     StartPos := pos('<a href="', Line);
  69.     delete(Line, 1, StartPos-1);
  70.     repeat
  71.          StartPos := pos('<a href="', Line);
  72.          delete(Line, 1, StartPos-1);
  73.          adresse := urlBase+findInfo('<a href="', '">', Line,'0');
  74.          titre := findInfo('">', '</a>', Line,'0');
  75. // Ajoute les films
  76.          if (titre = '')then
  77.            oK := False
  78.          else {if (pos('index.php?serie',adresse) <> 0) then}
  79.            listeResultat.Add(titre+'|'+adresse);
  80.          delete(Line, 1, length('<a href="'));
  81.     until (oK = False);
  82. // CrΘation de la liste de rΘsultats
  83.     nettoieListe();
  84.     afficheResultat(title);
  85.   end;
  86. end;
  87.  
  88. //------------------------------------------------------------------------------
  89. // NE PAS METTRE DEUX RESULTATS IDENTIQUES DANS LA LISTE
  90. //------------------------------------------------------------------------------
  91.  
  92. procedure nettoieListe();
  93. var
  94.    couple, titre, adresse : String;
  95. begin
  96.       for i:=0 to listeResultat.Count-1 do
  97.       begin
  98.            couple := listeResultat.GetString(i);
  99.            titre := copy(couple,0,pos('|',couple)-1);
  100.            delete(couple, 1, length(titre)+1);
  101.            adresse := copy(couple,0,length(couple));
  102.            for j:=i+1 to listeResultat.Count-1 do
  103.            begin
  104.                 if (supprimeLesAccents(copy(listeResultat.GetString(j),0,pos('|',listeResultat.GetString(j))-1)) = supprimeLesAccents(titre)) then
  105.                   listeResultat.SetString(j,'');
  106.            end;
  107.       end;
  108. end;
  109.  
  110. //------------------------------------------------------------------------------
  111. // CREATION DE LA LISTE DE RESULTAT
  112. //------------------------------------------------------------------------------
  113.  
  114. procedure afficheResultat(title : String);
  115. var
  116.    StartPos, k: Integer;
  117.    couple, titre, adresse, adresseunique : String;
  118. begin
  119.  
  120.   if (GetOption('Type de Lancement') = 0) or (GetOption('Type de Lancement') = 1) then
  121.   begin
  122.    PickTreeClear;
  123.    PickTreeAdd('RΘsultats trouvΘs pour ' + title + ' :', '');
  124.    k := 0;
  125.    for i:=0 to listeResultat.Count-1 do
  126.    begin
  127.      couple := listeResultat.GetString(i);
  128.      titre := copy(couple,0,pos('|',couple)-1);
  129.      delete(couple, 1, length(titre)+1);
  130.      HTMLDecode(titre);
  131.      adresse := copy(couple,0,length(couple));
  132.      adresse := URLEncode(adresse);
  133.      if titre <> '' then
  134.      begin
  135.         PickTreeAdd(titre, adresse);
  136.         k:= k+1;
  137.         adresseunique := adresse;
  138.      end;
  139.    end;
  140.  
  141.    if (listeResultat.Count = 1) or (k = 1) then
  142.    begin
  143.      recupInfo(adresseunique);
  144.      exit;
  145.    end;
  146. // ******************** DEBUT AFFICHAGE
  147.     begin
  148.       if PickTreeExec(Address)=true then
  149.       begin   
  150.           recupInfo(Address);
  151.       end;
  152.     end;
  153. // ******************** FIN AFFICHAGE
  154.   end else if (GetOption('Type de Lancement') = 2) then
  155.   begin
  156.    if listeResultat.Count = 1 then
  157.    begin
  158.      couple := listeResultat.GetString(0);
  159.      titre := copy(couple,0,pos('|',couple)-1);
  160.      delete(couple, 1, length(titre)+1);
  161.      HTMLDecode(titre);
  162.      adresse := copy(couple,0,length(couple));
  163.      adresse := URLEncode(adresse);
  164.      recupInfo(adresse);
  165.      exit;
  166.    end else
  167.    begin
  168.      trouveTitle(title);
  169.    end;
  170.   end;
  171. end;
  172.  
  173. //------------------------------------------------------------------------------
  174. // RECUPERE LES INFOS
  175. //------------------------------------------------------------------------------
  176.  
  177. procedure recupInfo(Adresse : String);
  178. var
  179.    Value, Value2, Line: String;
  180.    StartPos : Integer;
  181. begin
  182. // Pour le mode Batch
  183.    if (GetOption('Fichier de log') = 0) then
  184.      beforeUpdate();
  185. // DΘbut du script de rΘcupΘration
  186.    Sleep(500);
  187.    line  := PostPage(Adresse,'vol=0');
  188. // Jaquette Anime
  189.    if CanSetPicture then
  190.      GetPicture(urlBase+'images/'+findInfo('<img src="images/', '"', Line,'0'));
  191. // Titre
  192.    if CanSetField(fieldTranslatedTitle) and (GetOption('Choix Titre') = 0) then
  193.      MonSetField(fieldTranslatedTitle, formatTitre(findInfo('<b style=''font-size:18px''>', '</b><br>', Line,'0'),GetOption('Casse Choisie')));
  194.    if CanSetField(fieldOriginalTitle) and (GetOption('Choix Titre') = 1) then
  195.      MonSetField(fieldOriginalTitle, formatTitre(findInfo('<b style=''font-size:18px''>', '</b><br>', Line,'0'),GetOption('Casse Choisie')));
  196. // Genre
  197.    if CanSetField(fieldCategory) then
  198.       MonSetField(fieldCategory, formatTitre(findInfo('CatΘgories : ', '</b>', Line,'0'),GetOption('Casse Choisie')));
  199. // L'histoire
  200.    if CanSetField(fieldDescription) then
  201.    begin
  202.          Value := findInfo('<u>Histoire:</u><br>', '</td>', Line,'0');
  203.          Value := StringReplace(Value,'            ','');
  204.          MonSetField(fieldDescription,Value);
  205.    end;
  206. // Note
  207.    if CanSetField(fieldRating) then
  208.       MonSetField(fieldRating, findInfo('Note de la sΘrie</td><td>', ' / 10', Line,'0'));
  209. // AnnΘe
  210.    if CanSetField(fieldYear) then
  211.       MonSetField(fieldYear, findInfo('SΘrie crΘΘe en  </td><td>', '</td>', Line,'0'));
  212. // RΘalisateur
  213.    if CanSetField(fieldDirector) then
  214.       MonSetField(fieldDirector, formatTitre(findInfo('<tr><td>RΘalisateur</td><td>', '</td>', Line,'0'),GetOption('Casse Choisie')));
  215. // Studio
  216.    if CanSetField(fieldProducer) then
  217.       MonSetField(fieldProducer, formatTitre(findInfo('Studio</td>', '</td>', Line,'0'),GetOption('Casse Choisie')));
  218. // Informations ComplΘmentaires
  219.    if CanSetField(fieldActors) then
  220.    begin
  221.       Value2 := '';
  222.       Value := '';
  223.       Value := formatTitre(findInfo('Charac-designer</td>', '</td>', Line,'0'),GetOption('Casse Choisie'));
  224.       if Value <> '' then
  225.         Value2 := Value2+'Charac-designer : '+Value+#13#10;
  226.       Value := formatTitre(findInfo('Directeur d''animation</td>', '</td>', Line,'0'),GetOption('Casse Choisie'));
  227.       if Value <> '' then
  228.         Value2 := Value2+'Directeur d''animation : '+Value+#13#10;
  229.       Value := formatTitre(findInfo('Compositeur</td>', '</td>', Line,'0'),GetOption('Casse Choisie'));
  230.       if Value <> '' then
  231.         Value2 := Value2+'Compositeur : '+Value+#13#10;
  232.       Value := formatTitre(findInfo('Nombre d''Θpisode prΘvus </td>', '</td>', Line,'0'),GetOption('Casse Choisie'));
  233.       if Value <> '' then
  234.         Value2 := Value2+'Nombre d''Θpisodes prΘvus : '+Value+#13#10;
  235.       MonSetField(fieldActors, Value2);
  236.    end;
  237. // Adresse Web
  238.   if CanSetField(fieldURL) then
  239.       SetField(fieldURL, Adresse);
  240.  
  241. // Pour le mode Batch
  242.   if (GetOption('Fichier de log') = 0) then
  243.     afterUpdate();
  244.  
  245. end;
  246.  
  247. //------------------------------------------------------------------------------
  248. // SUPPRIME LES ACCENTS
  249. //------------------------------------------------------------------------------
  250.  
  251. function supprimeAccents(NomFilm : String) : String;
  252. begin
  253. // les accents
  254.      NomFilm := supprimeLesAccents(NomFilm);
  255. // Pour n'avoir que le titre
  256.      delete(NomFilm, pos(' - ',NomFilm), length(NomFilm));
  257.      if (pos(', ',NomFilm) > 0) then
  258.         delete(NomFilm, 1, pos(', ',NomFilm)+1);
  259.      if (pos('(',NomFilm) > 0) then
  260.         delete(NomFilm, pos('(',NomFilm), length(NomFilm));
  261.      if (pos(':',NomFilm) > 0) then
  262.         delete(NomFilm, pos(':',NomFilm), length(NomFilm));
  263.      result := trim(NomFilm);
  264. end;
  265.  
  266. //------------------------------------------------------------------------------
  267. // COMPARE LE TITRE PASSE ET LE TITRE TROUVE
  268. //------------------------------------------------------------------------------
  269.  
  270. function compareTitle(titleAllo, title : String) : String;
  271. begin
  272.      title := supprimeAccents(trim(AnsiLowerCase(title)));
  273.      titleAllo := supprimeAccents(trim(AnsiLowerCase(titleAllo)));
  274.      if (title = titleAllo) then
  275.      begin
  276.        result := 'OK';
  277.      end else
  278.      begin
  279.        result := 'KO';
  280.      end;
  281. end;
  282.  
  283. //------------------------------------------------------------------------------
  284. // TROUVE LE BON TITRE SI LE PREMIER N'EST PAS LE BON
  285. //------------------------------------------------------------------------------
  286.  
  287. procedure trouveTitle(title : String);
  288. var
  289.    oK, couple, titre, adresse : String;
  290. begin
  291.    for i:=0 to listeResultat.Count-1 do
  292.    begin
  293.      couple := listeResultat.GetString(i);
  294.      titre := copy(couple,0,pos('|',couple)-1);
  295.      delete(couple, 1, length(titre)+1);
  296.      HTMLDecode(titre);
  297.      adresse := copy(couple,0,length(couple));
  298.      adresse := URLEncode(adresse);
  299.      oK := compareTitle(title,titre);
  300.      if oK = 'OK' then
  301.      begin
  302.        recupInfo(adresse);
  303.        exit;
  304.      end;
  305.    end;
  306.    listeResultat.Free;
  307.  
  308. end;
  309.  
  310. //------------------------------------------------------------------------------
  311. // PROGRAMME PRINCIPAL
  312. //------------------------------------------------------------------------------
  313.  
  314. begin
  315. if AcceptLicense(1) then
  316.   if CheckVersion(3,5,0) then
  317.   begin
  318.     if GetOption('Mise α jour') = 0 then
  319.     begin
  320.        execMenuMAJ(VersionScript,NomScript);
  321.        exit;
  322.     end;
  323.     MovieName := recupTitreRecherche(GetOption('Recherche sur le titre'));
  324.     Sleep(1000);
  325.     if (GetOption('Fichier de log') = 0) and (premiereExecution = 0) then
  326.     begin
  327.       batch(NomScript);
  328.       AddToLog('Les films ayant ΘtΘ mis α jour sont maintenant cochΘs');
  329.     end;
  330.     if (GetOption('Type de Lancement') = 0) then
  331.     begin
  332.       if Input(NomScript+' by ScorEpioN', 'Entrez le titre de l''anime :', MovieName) then
  333.       begin
  334.         if Pos(urlDomain, MovieName) > 0 then
  335.         begin
  336.           recupInfo(MovieName);
  337.         end else
  338.           recherche(MovieName);
  339.       end;
  340.     end else
  341.     if (GetOption('Type de Lancement') = 3) then
  342.     begin
  343.       if (premiereExecution = 0) then
  344.       begin
  345.         premiereExecution := -1;
  346.         if (ShowConfirmation('Vous allez executer le script sans confirmation, cliquer sur ''''OUI'''' pour continuer') = False) then
  347.            exit;
  348.       end;
  349.       MovieName := GetField(fieldURL);
  350.       if Pos(urlDomain, MovieName) > 0 then
  351.          recupInfo(MovieName);
  352.     end else
  353.     begin
  354.       if (premiereExecution = 0) then
  355.       begin
  356.           premiereExecution := -1;
  357.           if (ShowConfirmation('Vous allez executer le script sans confirmation, cliquer sur ''''OUI'''' pour continuer') = True) then
  358.           begin
  359.             recherche(MovieName);
  360.           end else
  361.             exit;
  362.       end else
  363.       begin
  364.           recherche(MovieName);
  365.       end;
  366.     end;
  367.   end else
  368.     ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
  369. end.
  370.